/*
@author wsq
@date  2016-11-13 
@http 请求方法
@todo 有待改进 学习promise
@param reqbody {}
@param options {} 必传可以为{}
@param success fn
@param error fn
*/
import Vue from 'vue'
import VueResource from 'vue-resource'
import config from '../config.js'
Vue.use(VueResource);
Vue.http.options.emulateJSON = true;
let url = config.url
export default function (reqBody,options,success,error){
	Vue.http.post(url,reqBody,options).then(function(res){
		let reponese = JSON.parse(res.data)
		success&&success(reponese)
	}, function(err){
		error&&error(err)
	})
}